﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel;
using SharpShare.Configuration;
using SharpShare.Collections;

namespace SharpShare.Management.Data {
    [DataContract]
    public sealed class OpenFileInfo {
        public OpenFileInfo(string identifier, Path<string> path) {
            this.Identifier = identifier;
            this.Path = path;
        }

        [Browsable(false)]
        [DataMember]
        public string Identifier {
            get;
            private set;
        }

        public string Name {
            get {
                return this.Path.Last;
            }
        }

        [DisplayName("Storage Provider")]
        public string StorageProvider {
            get {
                return this.Path.First;
            }
        }

        [DataMember]
        public Path<string> Path { get; private set; }

        [DisplayName("Bytes Read")]
        [TypeConverter(typeof(BytesTypeConverter))]
        [DataMember]
        public long BytesRead { get; set; }

        [DisplayName("Bytes Written")]
        [TypeConverter(typeof(BytesTypeConverter))]
        [DataMember]
        public long BytesWritten { get; set; }

        [DisplayName("Date Opened")]
        [DataMember]
        public DateTime DateOpened { get; set; }

        [DisplayName("Date Last Accessed")]
        [DataMember]
        public DateTime DateLastAccessed { get; set; }

        [DisplayName("Access Mode")]
        [DataMember]
        public Storage.StorageFileAccess AccessMode { get; set; }
    }
}
